<template>
	<view>
		<nav_bar title='购物车 '></nav_bar>
		<uni-swipe-action>
			<uni-swipe-action-item v-for="(item,index) in list" :key="index" :right-options="options"
				@click="onClick(item)">
				<view class="box">
					<view style="line-height: 70px;">
						<checkbox-group>
							<label>
								<checkbox value="cb" checked="true" />
							</label>
						</checkbox-group>
					</view>
					<view>
						<image :src="item.logo" mode="" style="width: 80px;height: 80px;"></image>
					</view>
					<view>
						<view>
							名称：{{item.shopname}}
						</view>
						<view style="color: red;">
							价格：{{item.fee}}元
						</view>
					</view>
					<view>
						<uni-section>
							<uni-number-box :min="1" :max="10" />
						</uni-section>
					</view>
				</view>
			</uni-swipe-action-item>
		</uni-swipe-action>
		<view class="box1">
			<view>
				<checkbox-group>
					<label>
						<checkbox value="cb" checked="true" />
					</label>
				</checkbox-group>
			</view>
			<view>
				总价：<text>0元</text>
			</view>
			<view>
				<button style="background-color:darkgreen;color: aliceblue;">立即购买</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				options: [{
					text: '删除',
					style: {
						backgroundColor: '#dd524d'
					}
				}]
			}
		},
		onLoad() {
			let _this = this;
			uni.request({
				url: 'http://localhost:8002/admin/shoplists', //仅为示例，并非真实接口地址。
				method: 'get',
				success: (res) => {
					console.log(res.data);
					_this.list = res.data
				}
			})
		},
		methods: {
			onClick(item) {
				console.log(item);
			},
		},
	}
</script>

<style>
	.box {
		display: flex;
		height: 100px;
		margin-top: 10px;
	}

	.box1 {
		display: flex;
		justify-content: space-between;
		width: 100%;
		line-height: 50px;
		position: fixed;
		left: 0;
		bottom: 0;
		background-color: chocolate;
	}
</style>